// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数
exports.main = async (event) => {
  console.log(event)
  return cloud.openapi.security.imgSecCheck({
    media: {
      header: {
        'Content-Type': 'application/octet-stream'
      },
      contentType: 'image/png',
      value: Buffer.from(event.image)
    }
  }).then(res => {
    return res;
  }).catch(err => {
    return err;
  })
}